Skip to content

Feature/sma 54 max factor upper bound is hardcoded#72

Closed
mrnkslv wants to merge 80 commits intorelease/nodectl/v0.4.0from
feature/sma-54-max-factor-upper-bound-is-hardcoded
Closed

Feature/sma 54 max factor upper bound is hardcoded#72
mrnkslv wants to merge 80 commits intorelease/nodectl/v0.4.0from
feature/sma-54-max-factor-upper-bound-is-hardcoded

Conversation

@mrnkslv
Copy link
Copy Markdown

@mrnkslv mrnkslv commented Apr 8, 2026

Summary

Remove the hardcoded max_factor upper bound of 3.0 and read the actual limit from the network's config param 17 (max_stake_factor). Previously, nodectl rejected any max_factor above 3.0 even on networks (e.g. testnet) that allow up to 30.0.

Changes

Reading network limit

  • ton_utils: add MAX_STAKE_FACTOR_SCALE constant and max_stake_factor_raw_to_multiplier() to convert the raw fixed-point value from param 17 to a float multiplier.
  • config_params: add parse_config_param_16() and parse_config_param_17() for deserializing validator count limits and stake limits from the chain.
  • client_json_rpc: add network_max_stake_factor_raw() and network_max_stake_factor_multiplier() methods to fetch the network cap via TON HTTP API.

Validation

  • ElectionsConfig::validate(Option<f32>): accept an optional upper bound.
    • None (offline, e.g. AppConfig::load): only checks max_factor >= 1.0 — no upper cap, so configs written for high-limit networks still load.
    • Some(m) (service startup / reload): enforces max_factor ∈ [1.0, m] using the live network value.
  • config elections max-factor CLI: fetches param 17 via RPC before saving and validates against the network limit.
  • config wallet stake --max-factor CLI: same RPC-based validation before submitting the stake.
  • RuntimeConfigStore (service): validates against network_max on initialize() and reload().
  • runner::build_new_stake_payload: validates the raw max_factor in the stake payload against cfg17.max_stake_factor.

Tests

  • test_elections_validate_max_factor_respects_network_capSome(3.0) rejects 5.0, Some(5.0) accepts it.
  • test_elections_validate_none_allows_max_factor_above_default_capNone accepts 25.0, Some(3.0) rejects, Some(30.0) accepts.
  • Timing validation tests (sleep_period_pct, waiting_period_pct) updated to use validate(None).

Documentation

  • README: updated config elections max-factor, elections config section, and config wallet stake table to reflect that the upper bound comes from config param 17, not a hardcoded 3.0.

bvscd and others added 30 commits March 23, 2026 12:57
Validate query uses capabilities from blockchain config, not candidate block
Simplex sessions late join bugfix
Cells DB: added cells cache
Reliable fast sync overlay creation
Additional updates on Simplex
Fix blockchain config operations for VM emulator
bvscd and others added 21 commits April 4, 2026 13:01
Fix storage phase for special account: issue #27
Preserve original due_payment for special accounts in partial storage phase: issue #27
enforce mcStateExtra flags <=1 and remove debug ValidatorsStat struct
fix masterchain ValueFlow burned fees and blackhole accounting
Updates for Simplex. Support of separate address for QUIC
Copilot AI review requested due to automatic review settings April 8, 2026 10:43
@linear
Copy link
Copy Markdown

linear bot commented Apr 8, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

…und-is-hardcoded"

This reverts commit fa35c52, reversing
changes made to 4ef0fcf.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mrnkslv mrnkslv closed this Apr 8, 2026
@mrnkslv mrnkslv deleted the feature/sma-54-max-factor-upper-bound-is-hardcoded branch April 8, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants